//**************************************************************************************************************
// CLASS: InstrTypeB
//
// DESCRIPTION
// A type B instruction is a branch instruction. Each branch instruction encodes the branch target address in
// the address field of the instruction. All branch instructions are instances of this class.
//
// Note that InstTypeB is derived from Instr.
//
// AUTHOR INFORMATION
// Group 2
// Tyler Williams
// Lauren Walker
// Cameron Stewart
// Fatimah Alowah
//**************************************************************************************************************
#ifndef INSTRTYPEB_HPP
#define INSTRTYPEB_HPP

#include <string>
#include "Instr.hpp"
#include "Label.hpp"

//==============================================================================================================
// CLASS: InstrTypeB (derived from Instr)
//==============================================================================================================
class InstrTypeB : public Instr {

public:
    //==========================================================================================================
    // PUBLIC FUNCTION MEMBERS:
    //==========================================================================================================

    //----------------------------------------------------------------------------------------------------------
    // Default ctor.
    //----------------------------------------------------------------------------------------------------------
    InstrTypeB
        (
        );

    //----------------------------------------------------------------------------------------------------------
    // Constructor. A type B instruction has a mnemonic and a branch target label.
    //----------------------------------------------------------------------------------------------------------
    InstrTypeB
        (
        std::string const& pMnemonic,
        Label const&       pLabel
        );

    //----------------------------------------------------------------------------------------------------------
    // Copy ctor.
    //----------------------------------------------------------------------------------------------------------
    InstrTypeB
        (
        InstrTypeB const& pInstr
        );

    //----------------------------------------------------------------------------------------------------------
    // Virtual dtor.
    //----------------------------------------------------------------------------------------------------------
    virtual ~InstrTypeB
        (
        );

    //----------------------------------------------------------------------------------------------------------
    // Encode()
    //----------------------------------------------------------------------------------------------------------
    virtual void Encode
        (
        );

    //----------------------------------------------------------------------------------------------------------
    // GetLabel()
    //----------------------------------------------------------------------------------------------------------
    Label GetLabel
        (
        )
        const;

    //----------------------------------------------------------------------------------------------------------
    // operator=()
    //----------------------------------------------------------------------------------------------------------
    InstrTypeB& operator=
        (
        InstrTypeB const& pInstr
        );

protected:
    //==========================================================================================================
    // PROTECTED UNCTION MEMBERS:
    //==========================================================================================================

    //----------------------------------------------------------------------------------------------------------
    // Copy()
    //----------------------------------------------------------------------------------------------------------
    void Copy
        (
        InstrTypeB const& pInstr
        );

    //----------------------------------------------------------------------------------------------------------
    // SetLabel()
    //----------------------------------------------------------------------------------------------------------
    void SetLabel
        (
        Label const& pLabel
        );

private:
    //==========================================================================================================
    // PRIVATE DATA MEMBERS:
    //==========================================================================================================
    Label mLabel;
};

#endif
